package com.chatgpt_backend.entity;


import lombok.Data;

@Data
public class RespBean<T> {
    private int status;
    private boolean success;
    private String message;
    private T data;

    private RespBean(int status, boolean success, String message, T data) {
        this.status = status;
        this.success = success;
        this.message = message;
        this.data = data;
    }

    public static <T> RespBean<T> success() {
        return new RespBean<T>(200, true, null, null);
    }

    public static <T> RespBean<T> success(String msg) {
        return new RespBean<T>(200, true, msg, null);
    }
    public static <T> RespBean<T> success(String msg, T data) {
        return new RespBean<T>(200, true, msg, data);
    }

    public static <T> RespBean<T> failure(int status) {
        return new RespBean<T>(status, false, null, null);
    }

    public static <T> RespBean<T> failure(int status, String msg) {
        return new RespBean<T>(status, false, msg, null);
    }

}
